@CrossOrigin
@RestController
@RequestMapping("/jiapei/feedback")
public class FeedbackController {
    @Autowired
    private FeedbackService feedbackService;
    @ApiOperation("反馈时间")
    @GetMapping("/backtime")
    public R getfeedbackList(@ApiParam("当前页") @RequestParam(value = "page", required = true, defaultValue = "1") Integer page,
                             @ApiParam("分页标准") @RequestParam(value = "limit", required = true, defaultValue = "5") Integer limit,
                             FeedbackQuery feedbackQuery) throws MyException, ParseException {
        Page<Feedback> pageBean = new Page<>(page, limit);
        QueryWrapper queryWrapper = new QueryWrapper<>();
        if (!StringUtils.isEmpty(feedbackQuery.getStartTime())) {
            queryWrapper.ge("putime", feedbackQuery.getStartTime());
        }
        if (!StringUtils.isEmpty(feedbackQuery.getEndTime())) {
            queryWrapper.le("putime", feedbackQuery.getEndTime());
        }
        Page<Feedback> resultPage = feedbackService.page(pageBean, queryWrapper);
        List<Feedback> records = resultPage.getRecords();
        long total = resultPage.getTotal();

        if (records != null && records.size() > 0) {
            return R.ok().data("records", records).data("total", total);
        } else {
            throw new MyException(ResultCode.GETFEEDBACKAILED,ResultMsg.GETFEEDBACKAILEDMSG);

        }
    }

    @ApiOperation("根据id删除反馈")
    @DeleteMapping("/deleteback/{id}")
    public R deleteback(@PathVariable Integer id){
        feedbackService.removeById(id);
        return R.ok();
    }
    @ApiOperation("新增反馈")
    @PostMapping("/addback")
    public R addback(@RequestBody Feedback feedback) {
        feedback.setPutime(new Date());
        feedbackService.save(feedback);
        return R.ok();
    }
}




















@Data
@ApiModel
public class FeedbackQuery {
    
    @ApiModelProperty("创建起始时间")
    private String startTime;

    @ApiModelProperty("创建截止时间")
    private String endTime;
}